﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using T.FAS.Runtime.Base.Dao;
using T.FAS.Runtime.Base.Entity;
using T.FAS.Runtime.Base.Service;
using T.FAS.Runtime.Base.SGSPI;
using T.ServiceComponent.Kernel.Service;

namespace T.FAS.Runtime.Base.SGPlugin
{
    [SGService]
    public class ChartSGService : IChartService
    {
        readonly ChartService service = new ChartService();
        /// <summary>
        /// 查询图表库
        /// </summary>
        /// <returns></returns>
        public List<ChartLib> GetChartLibs()
        {
            return service.GetChartLibs();
        }
        /// <summary>
        /// 查询图表列表
        /// </summary>
        /// <returns></returns>
        public List<ChartInstanceApply> GetChartInstanceApplys(TargetType targetType, string targetID)
        {
            return service.GetChartInstanceApplys(targetType, targetID);
        }
        /// <summary>
        /// 创建或更新
        /// </summary>
        /// <param name="chart"></param>
        public Dictionary<string, string> CreateOrUpdateChart(ChartInstanceApply chart)
        {
            if (chart == null)
                throw new FasException(BaseExceptionCode.ParamIsNullError, "ChartSGService.CreateOrUpdateChart.chart");
            return service.CreateOrUpdateChart(chart);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        public Dictionary<string, string> DeleteChart(string id)
        {
            return service.DeleteChart(id);
        }
    }
}
